const Sequelize = require('sequelize');
module.exports = function(sequelize, DataTypes) {
  return sequelize.define('downloadfile', {
    id: {
      type: DataTypes.STRING(64),
      allowNull: false,
      primaryKey: true,
      comment: "唯一id"
    },
    userId: {
      type: DataTypes.STRING(64),
      allowNull: true,
      comment: "用户id"
    },
    fileListId: {
      type: DataTypes.STRING(64),
      allowNull: true,
      comment: "文件id"
    },
    downloadFileName: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "下载时候的文件名称"
    },
    downloadSpeed: {
      type: DataTypes.INTEGER,
      allowNull: true,
      comment: "下载速度，0是不限制速度"
    },
    expirationTime: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "过期时间"
    },
    createTime: {
      type: DataTypes.DATE,
      allowNull: true,
      comment: "创建时间"
    },
    active: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "是否存在1存在0不存在"
    }
  }, {
    sequelize,
    tableName: 'downloadfile',
    timestamps: false,
    indexes: [
      {
        name: "PRIMARY",
        unique: true,
        using: "BTREE",
        fields: [
          { name: "id" },
        ]
      },
    ]
  });
};
